import 'package:flutter/material.dart';
import 'package:flutter_chat/common/constant/constants.dart';
import 'package:flutter_chat/common/style/styles.dart';
import 'package:flutter_chat/common/widget/widgets.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';

import 'logic.dart';

class UserHomePage extends GetView<UserHomeLogic> {
  UserHomePage({super.key});

  @override
  final String tag =
      "${RouterTag.userHome}${Get.parameters[RouterParam.username]}";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppBar("用户信息"),
      body: ListView(
        physics: const BouncingScrollPhysics(
          parent: AlwaysScrollableScrollPhysics(),
        ),
        children: [
          _buildUserInfo(),
          const Divider(height: 1),
          CellWidget(
            right: GestureDetector(
              onTap: () {},
              child: const Icon(
                Icons.chevron_right,
                color: AppTheme.minorColor,
              ),
            ),
            title: "设置备注",
          ),
          const Gap(AppTheme.largeSpace),
          SizedBox(
            height: 40,
            child: ElevatedButton(
              onPressed: () {},
              child: const Text("发消息"),
            ),
          ),
        ],
      ),
    );
  }

  Container _buildUserInfo() {
    return Container(
      padding: const EdgeInsets.all(25),
      color: Colors.white,
      child: const Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          ImageWidget(
            "http://q1.qlogo.cn/g?b=qq&nk=3355691290&s=640",
            size: 60,
            radius: AppTheme.radius,
          ),
          Gap(15),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                "今天比昨天更爱你",
                style: TextStyle(
                  fontSize: AppTheme.largeFont,
                  fontWeight: FontWeight.bold,
                ),
              ),
              Gap(AppTheme.middleSpace),
              Text(
                "昵称: 今天比昨天更爱你",
                style: TextStyle(
                  fontSize: AppTheme.smallFont,
                  color: AppTheme.infoColor,
                ),
              ),
              Gap(AppTheme.middleSpace),
              Text(
                "账号: 2327972001",
                style: TextStyle(
                  fontSize: AppTheme.smallFont,
                  color: AppTheme.infoColor,
                ),
              ),
              Gap(AppTheme.middleSpace),
              Text(
                "地区: 广东 深圳",
                style: TextStyle(
                  fontSize: AppTheme.smallFont,
                  color: AppTheme.infoColor,
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
